package info.zlong.visibleruntime;

import java.util.UUID;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import info.zlong.visibleruntime.core.LoggerUtil;

public class Log4j2Test {
	private final static Logger logger = LogManager.getLogger("MONGODB");
	
	public static void main(String[] args){
		for(int i=0;i<1;i++){
			new Thread(new Runnable() {
				public void run() {

					for(int i=0;i<10;i++){
						log();
					}
				}
			}).start();
		}
	}

	private static void log() {
		LoggerUtil.initLogMsgId(System.currentTimeMillis()+UUID.randomUUID().toString().replaceAll("-", ""));

		logger.info(LoggerUtil.startLog("L1", "level1 start"));
		{

			logger.info(LoggerUtil.startLog("L2", "level2 start"));
			{

				logger.info(LoggerUtil.startLog("L3", "level3 start"));
				{

					logger.info(LoggerUtil.log("level4 start"));
					logger.info(LoggerUtil.log("leve4 end"));
					
					logger.info(LoggerUtil.log("level4-1 start"));
					logger.info(LoggerUtil.log("leve4-1 end"));
				}
				logger.info(LoggerUtil.endLog("L3","leve3 end"));
				
				
				logger.info(LoggerUtil.startLog("L3-1", "level3-1 start"));
				logger.info(LoggerUtil.endLog("L3-1", "leve3-1 end"));
			}
//			logger.info(LoggerUtil.popLog("L2", "leve2 end"));
		}
		logger.info(LoggerUtil.endLog("L1", "leve1 end"));
		

		logger.info(LoggerUtil.log("L1-1"));
	}
}
